<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="DoMain.Student" %>
<%@ page import="java.util.*" %>
<%@page import="java.text.SimpleDateFormat"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
 <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<title>updateMyself</title>
<script type="text/javascript">
	function tip(){
		
		alert("已修改成功，宿舍管理员可实时查看你修改的信息，点击确定返回当前页！");
	}
</script>
</head>
<body>
<% 
		Object msg=request.getAttribute("message");
		if(msg!=null){	
	%>
	
	<font color="red"><%=msg %></font>
	
	<%	} %>
	
	<%	
	String studentNo=null;
	String studentName=null;
	String sex=null;
	String className=null;
	String dormName=null;
	String roomNo=null;
	String lateDate=null;

	
	Student student=(Student)request.getAttribute("student");	
	
	if(student!=null){
		
		studentNo=student.getStudentNo()+"";
		studentName=student.getStudentName();
		sex=student.getSex();
		className=student.getClassName();
		dormName=student.getDormName();
		roomNo=student.getRoomNo();

		
	%>
	
	<% }else{
		studentNo=request.getParameter("studentNo");
		studentName=request.getParameter("studentName");
		sex=request.getParameter("sex");
		className=request.getParameter("className");
		dormName=request.getParameter("dormName");
		roomNo=request.getParameter("roomNo");

		
	}
	%>
	
	<form action="updateMyself.So" method="post">
	
	<input type="hidden" name="studentNo" value="<%=studentNo%>">
	<input type="hidden" name="studentName" value="<%=studentName%>">

	<div class="input-group">
    <span class="col-sm-2 col-form-label">我的姓名:</span>
	<input type="text" name="studentName" value="<%=studentName%>">
	</div>
	<div class="input-group">
    <span class="col-sm-2 col-form-label">性别:</span>
	<input type="radio" name="sex" value="男" <%if("男".equals(sex)){ %>  checked="checked" <%  } %>>男
	<input type="radio" name="sex" value="女" <%if("女".equals(sex)){ %>  checked="checked" <%  } %>>女
    </div>
    <div class="input-group">
    <span class="col-sm-2 col-form-label">班别:</span>
	<input type="text" name="className" value="<%=className%>">
	</div>
	<div class="input-group">
    <span class="col-sm-2 col-form-label">楼栋:</span>
    <input type="text" name="dormName" value="<%=dormName%>">
    </div>
    <div class="input-group">
    <span class="col-sm-2 col-form-label">宿舍号:</span>
    <input type="text" name="roomNo" value="<%=roomNo%>">
    </div>    
	<div class="input-group">
    <button type="submit" class="btn btn-primary" onclick="tip()">Submit</button>
    </div>
	</form>
</body>
</html>